package com.jrx.anytxn.param.job.bactchBillCompare.step;

import com.jrx.anytxn.number.service.ISegmentService;
import com.jrx.anytxn.param.constant.Constant;
import com.jrx.anytxn.param.entity.TlBillTransCompareDetail;
import com.jrx.anytxn.param.entity.TlBillTransDetil;
import org.springframework.batch.item.ItemProcessor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class BillDetailUnmatchedProcessor implements ItemProcessor<TlBillTransDetil, TlBillTransCompareDetail> {

    @Autowired
    private ISegmentService iSegmentService;

    @Override
    public TlBillTransCompareDetail process(TlBillTransDetil item) throws Exception {
        TlBillTransCompareDetail tlBillTransCompareDetail = new TlBillTransCompareDetail();
        tlBillTransCompareDetail.setId(iSegmentService.getId("TlBillTransCompareDetail"));
        tlBillTransCompareDetail.setTenantId(item.getTenantId());
        tlBillTransCompareDetail.setOrganizationId(item.getOrganizationId());
        tlBillTransCompareDetail.setBillType(item.getTransactionType());
        tlBillTransCompareDetail.setCompareStatus(Constant.COMPARE_FLAG_0);
        tlBillTransCompareDetail.setCompareDesc("该转账明细未匹配到TXN交易记录");
        tlBillTransCompareDetail.setCustomerId("");
        tlBillTransCompareDetail.setLoanNumber(item.getLoanNumber());
        tlBillTransCompareDetail.setSeqNo("");
        tlBillTransCompareDetail.setDetailAmount(item.getTransactionAmount());
        tlBillTransCompareDetail.setTxnPostingAmnt(null);
        tlBillTransCompareDetail.setBillTransStatus(item.getTransStatus());
        tlBillTransCompareDetail.setTxnTransStatus(null);
        tlBillTransCompareDetail.setBusinessDate(item.getBusinessDate());
        return tlBillTransCompareDetail;
    }
}
